import httpRequest from '@/utils/httpRequest'


export function getAllMenu (data) {
  return httpRequest({
    url: httpRequest.adornUrl('/sys/menu/list'),
    method: 'get',
    params: httpRequest.adornParams(data)
  })
}

export function deleteMenu (id) {
  return httpRequest({
    url: httpRequest.adornUrl(`/sys/menu/delete/${id}`),
    method: 'post',
    data: httpRequest.adornData()
  })
}

export function selectMenu (data) {
  return httpRequest({
    url: httpRequest.adornUrl('/sys/menu/select'),
    method: 'get',
    params: httpRequest.adornParams(data)
  })
}

export function menuInfoById (id) {
  return httpRequest({
    url: httpRequest.adornUrl(`/sys/menu/info/${id}`),
    method: 'get',
    params: httpRequest.adornParams()
  })
}

export function menuInfoSave (data) {
  return httpRequest({
    url: httpRequest.adornUrl(`/sys/menu/${!data.menuId ? 'save' : 'update'}`),
    method: 'post',
    data: httpRequest.adornData(data)
  })
}
